<?php

namespace common\models;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "mops_notice_api_log".
 *
 * @property int $id
 * @property string $phone
 * @property int $coupon_id
 * @property int $created_at
 * @property int $updated_at
 * @property int $attempt
 * @property string $msg
 * @property int $status
 */
class NoticeApiLog extends \yii\db\ActiveRecord
{
    const STATUS_SUCCESS = 1;
    const STATUS_FAILURE = 0;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%notice_api_log}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['coupon_id', 'created_at', 'updated_at', 'attempt', 'status'], 'integer'],
            [['phone'], 'string', 'max' => 11],
            [['msg'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'phone' => 'Phone',
            'coupon_id' => 'Coupon ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'attempt' => 'Attempt',
            'msg' => 'Msg',
            'status' => 'Status',
        ];
    }

    public function behaviors()
    {
        return [
            TimestampBehavior::class
        ];
    }

    public static function getStatusList()
    {
        return [
            self::STATUS_SUCCESS => '成功',
            self::STATUS_FAILURE => '失败'
        ];
    }
}
